#include <iostream>
#include <ctime>
using namespace std;
const int N = 1e5 + 10;
int n;
int a[N];

int get_random(int left, int right)
{
    return a[rand() % (right - left + 1) + left];
}

// 对[left, right]排序
void quick_sort(int left, int right)
{
    if(left >= right) return;
    // 挑选基准元素
    int p = get_random(left, right);

    int l = left - 1, i = left, r = right + 1;
    while(i < r)
    {
        if(a[i] < p) swap(a[++l], a[i++]);
        else if(a[i] == p) i++;
        else swap(a[i], a[--r]);
    }
    // 继续递归排序左右区间
    quick_sort(left, l);
    quick_sort(r, right);
}
int main()
{
    cin >> n;
    srand(time(0));
    for(int i = 1;i <= n;i++) cin >> a[i];

    quick_sort(1, n);

    for(int i = 1;i <= n;i++) cout << a[i] << " ";
    return 0;
}